package com.hnevc.accountkitdemo;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.huawei.hmf.tasks.OnFailureListener;
import com.huawei.hmf.tasks.OnSuccessListener;
import com.huawei.hmf.tasks.Task;
import com.huawei.hms.support.account.AccountAuthManager;
import com.huawei.hms.support.account.request.AccountAuthParams;
import com.huawei.hms.support.account.request.AccountAuthParamsHelper;
import com.huawei.hms.support.account.result.AuthAccount;
import com.huawei.hms.support.account.service.AccountAuthService;
import com.huawei.hms.support.hwid.request.HuaweiIdAuthParams;
import com.huawei.hms.support.hwid.request.HuaweiIdAuthParamsHelper;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
    private static final String TAG = "LoginActivity";
    private Button account_signin;
    private Button account_signInCode;
    private Button account_silent_signin;
    private Button account_signout;
    private Button cancel_authorization;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        initView();
    }

    private void initView() {
        account_signin = (Button) findViewById(R.id.account_signin);
        account_signInCode = (Button) findViewById(R.id.account_signInCode);
        account_silent_signin = (Button) findViewById(R.id.account_silent_signin);
        account_signout = (Button) findViewById(R.id.account_signout);
        cancel_authorization = (Button) findViewById(R.id.cancel_authorization);


        account_signin.setOnClickListener(this);
        account_signInCode.setOnClickListener(this);
        account_silent_signin.setOnClickListener(this);
        account_signout.setOnClickListener(this);
        cancel_authorization.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.account_signin:
                signIn();
                break;
            case R.id.account_signInCode:
                singInCode();
                break;
            case R.id.account_silent_signin:
                silentSingIn();
                break;
            case R.id.account_signout:
                signOut();
                break;
            case R.id.cancel_authorization:
                cancelAuthorization();
                break;
        }
    }

    private void signOut() {
        // 登出
    }

    private void silentSingIn() {
        // 静默登录
    }

    private void cancelAuthorization() {
        // 取消授权
    }

    private void singInCode() {
        // 使用调起授权页面授权登录 AuthCode登录

    }

    private void signIn() {
        // 使用调起授权页面授权登录 ID Token登录

    }
}